#ifndef _NodeManager
#define _NodeManager

#include <time.h>
#include <Windows.h>
#include <strsafe.h>	// safe string functions related to directory listing

#include "ParamManager.h"
#include "common.h"


// called after the module is loaded, useful to load global variables; Returns supported actions as a ParamManager*
typedef ParamManager* (*load)(void);
// called after the module is unloaded, useful to unload global variables
typedef void (*unload)(void);
// launch a thread
typedef void (*start)(HANDLE /*mutex*/, ParamManager& /*detail*/, char* /*index*/);


struct Node {
	HINSTANCE hLibrary;

	// functions loaded from the dll
	load _load;
	unload _unload;
	start _start;

	ParamManager pm;

	Node *prev, *next;
};

class NodeManager {
	Node *head;

public:
	// Constructor
	NodeManager();

	// Deconstructor
	~NodeManager();

	// add a new node
	Node* add(char* /*dll*/);

	// get a node by the specified todo
	Node* get(char* /*todo*/);

	// del a node by the specified id
	bool del(Node* /*node*/);

	// load available node modules
	bool load();
};

#endif // _NodeManager